/*
You are given n dice. Each die has m sides i.e has values from 1 to m. Given m,n,x calculate the probability that the sum of all the dice is greater than or equal to x.

For eg:
n=4 m=2 x=8 
ans: 1/8=0.125
n=2 m=6 x=3
ans:35/36=0.972
*/

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

void calProbHelper(int index, int m, int n, int x, int cur, int &count)
{
    if (index == n) {
        if (cur >= x) count++;
        return;
    }
    for (int i = 1; i <= m; i++) {
        calProbHelper(index+1, m, n, x, cur + i, count);
    }
}


double calProb(int n, int m, int x)
{
    int count = 0, cur = 0;
    int total = pow(m, n);
    cout << total << endl;
    calProbHelper(0, m, n, x, cur, count);
    return (double)count/(double)total;
}

int main(int argc, char **argv)
{
    int n, m, x;
    n=4;
    m=2;
    x=8;
    cout << "-----------------Test 1--------------------" << endl;
    cout << calProb(n, m, x) << endl;




}
